*** This do file replicates the results presented in
*** Garriga, Ana Carolina.  2025.  "Revisiting Central Bank Independence in the World: An Extended Dataset."

*** If the dataset on CBI is updated and/or corrected, future versions will be posted here --> https://sites.google.com/site/carogarriga/


cd "C:\Users\[directory]"  
   global root"C:\Users\[directory]"
   global out "$root\out"
 

* Table 1

   use Replication_ISQ_2025.dta, clear
   
   tab cowcode if creation!=.  // number of countries in sample
   tab regional if year>1969    // number of regional observations
   

   sum cowcode year creation reform direction increase decrease regional cuk_ceo cuk_obj cuk_pol cuk_limlen lvau_garriga lvaw_garriga lvaw_garriga2016 diffusion_reg if creation!=. & year>1969
   
   sum  lvau_garriga lvaw_garriga lvaw_garriga2016 lvaw_bh lvaw_ro if year>1969
   pwcorr lvaw_garriga lvaw_garriga2016 lvaw_bh lvaw_ro if year>1969
   
  
*    footnote on regional
     tab regional
     drop if regional==1
     sum cowcode year creation reform direction increase decrease regional cuk_ceo cuk_obj cuk_pol cuk_limlen lvau_garriga lvaw_garriga lvaw_garriga2016 diffusion_reg if creation!=.
     sum lvaw_bh lvaw_ro
      
   
* N countries per year

   use Replication_ISQ_2025, clear
   collapse (count) creation lvaw_garriga lvaw_garriga2016 lvaw_bh lvaw_ro, by (year)

   
*  Figure 1

   use Replication_ISQ_2025, clear

   tsset cowcode year
   drop if year<1970

   gen CBI_garriga=lvaw_garriga 
   gen CBI_garriga2016=lvaw_garriga2016 
   gen CBI_bh=lvaw_bh 
   gen CBI_ro=lvaw_ro
   gen ref_count=reform

   collapse (count) ref_count lvaw_garriga lvaw_garriga2016 lvaw_bh lvaw_ro (mean) CBI_garriga CBI_garriga2016 CBI_bh CBI_ro (sum) reform, by (year)

   recode lvaw_bh (0=.)
   recode lvaw_ro (0=.)
   recode lvaw_garriga2016 (0=.)

   gen ref_rate=reform/ref_count*100
   
   gen dif_ave=CBI_garriga-CBI_bh
   order dif_ave, first
   drop dif_ave
   
   gen obsdif_bh=lvaw_garriga -lvaw_bh   
   gen obsdif_ro=lvaw_garriga -lvaw_ro
 
 	set scheme  s1manual    	   

   twoway (line lvaw_garriga year, sort lcolor(cranberry) lwidth(thick)) (line lvaw_garriga2016 year, sort lcolor(gs4)lpattern(longdash) lwidth(medthick))(line lvaw_ro year, lcolor(gs8) lpattern(dash_dot) lwidth(medthick) sort)  (line lvaw_bh year, lcolor(emerald) lpattern(dash_3dot) lwidth(medthick) sort), ytitle(Number of countries) legend (off) title(Countries included per year) subtitle(Different datasets) graphregion(fcolor(white)) xtitle(Year) 

    graph save "Graph" "$out\fig1a.gph", replace
 
twoway (line CBI_garriga year, sort lcolor(cranberry) lwidth(thick)) (line CBI_garriga2016 year, sort lcolor(gs4)lpattern(longdash) lwidth(medthick))(line CBI_ro year, lcolor(gs8) lpattern(dash_dot) lwidth(medthick) sort) (line CBI_bh year, lcolor(emerald) lpattern(dash_3dot) lwidth(medthick) sort), ytitle(CBI sample average) legend (order(1 "Author" 2 "Garriga (2016)" 3 "Romelli (2022)" 4 "Bodea&Hicks (updated)") rows(2) size(small)) graphregion(fcolor(white)) title(CBI sample average) subtitle(Different datasets) xtitle(Year) 

    graph save "Graph" "$out\fig1b.gph", replace
 
graph combine "$out\fig1a.gph" "$out\fig1b.gph", iscale(*1.25) xsize(25) ysize(12) graphregion(color(white))
    graph save "Graph" "$out\fig1.gph", replace

	
	
* text: number of reforms
   use Replication_ISQ_2025, clear

   drop if year<1970
   tab reform
   tab increase
   tab decrease
   tab direction
   tab direction reform

   list cowcode cname year lvaw_garriga if reform==1 & direction==. 
list cname year lvaw_garriga if reform ==1 & direction==0 
sum reform if direction==.  // 1 case in which I cannot determine direction

tab reform direction if year <2000
tab reform direction if year >1999


* Figure 2 Count of reforms affecting CBI, and countries included in samples. Worldwide and regional subsamples.

use Replication_ISQ_2025, clear

drop if year<1970
drop if creation==.

generate lvaw_eeu=lvaw_garriga if ht_region==1
generate lvaw_lam=lvaw_garriga if ht_region==2|ht_region==10
generate lvaw_af=lvaw_garriga if ht_region==3|ht_region==4
generate lvaw_wenam=lvaw_garriga if ht_region==5
generate lvaw_asiap=lvaw_garriga if ht_region==6|ht_region==7|ht_region==8|ht_region==9

generate i_eeu=increase if ht_region==1
generate i_lam=increase if ht_region==2|ht_region==10
generate i_af=increase if ht_region==3|ht_region==4
generate i_wenam=increase if ht_region==5
generate i_asiap=increase if ht_region==6|ht_region==7|ht_region==8|ht_region==9

generate d_eeu=decrease if ht_region==1
generate d_lam=decrease if ht_region==2|ht_region==10
generate d_af=decrease if ht_region==3|ht_region==4
generate d_wenam=decrease if ht_region==5
generate d_asiap=decrease if ht_region==6|ht_region==7|ht_region==8|ht_region==9

generate c_eeu=1 if ht_region==1
generate c_lam=1 if ht_region==2|ht_region==10
generate c_af=1 if ht_region==3|ht_region==4
generate c_wenam=1 if ht_region==5
generate c_asiap=1 if ht_region==6|ht_region==7|ht_region==8|ht_region==9

 
collapse (sum) reform increase decrease i_eeu i_lam i_af i_wenam i_asiap d_eeu d_lam d_af d_wenam d_asiap c_eeu c_lam c_af c_wenam c_asiap (count) cowcode (mean) lvaw_eeu lvaw_lam lvaw_af lvaw_wenam lvaw_asiap , by (year)

*    Reforms per country and per year

replace decrease=(-1)*decrease
rename decrease CBI_decreases
rename increase CBI_increases
gen Year=.
replace Year=year if year==1970|year==1980|year==1990|year==2000|year==2010
replace d_eeu=(-1)*d_eeu
replace d_lam=(-1)*d_lam
replace d_af=(-1)*d_af
replace d_wenam=(-1)*d_wenam
replace d_asiap=(-1)*d_asiap
    

twoway (bar CBI_increases year, fcolor(gs8) lcolor(gs3)) (bar CBI_decreases year, fcolor(gs4)  lcolor(black)) (line cowcode year, sort yaxis(2) lcolor(cranberry)), ytitle(Number of reforms) ytitle(Number of countries in sample, axis(2)) xtitle(Year) title(World sample) /*subtitle ((Regional central banks excluded))*/ legend (order(1 "CBI increases" 2 "CBI decreases" 3 "Number of countries (secondary axis)" ) rows (2) size(small)) graphregion(fcolor(white)) 

	   graph save "Graph" "$out\r_all.gph", replace

twoway (bar i_lam year, fcolor(gs8) lcolor(gs3)) (bar d_lam year, fcolor(gs3)  lcolor(black)) (line c_lam year, sort yaxis(2) lcolor(cranberry)), ytitle(Number of reforms) ytitle(Number of countries in sample, axis(2)) ymtick(0(10)40, axis(2)) xtitle(Year) title(Latin America and the Caribbean) legend (off)/*(order(1 "CBI decreases" 2 "CBI increases" 3 "Number of countries (secondary axis)" ) rows (2) size(small))*/ graphregion(fcolor(white)) 

	   graph save "Graph" "$out\r_lam.gph", replace

twoway (bar i_asiap year, fcolor(gs8) lcolor(gs3)) (bar d_asiap year, fcolor(gs3)  lcolor(black)) (line c_asiap year, sort yaxis(2) lcolor(cranberry)), ytitle(Number of reforms) ytitle(Number of countries in sample, axis(2)) ymtick(0(10)40, axis(2)) xtitle(Year) title(Asia and the Pacific) legend (off)/*(order(1 "CBI decreases" 2 "CBI increases" 3 "Number of countries (secondary axis)" ) rows (2) size(small))*/ graphregion(fcolor(white)) 

	   	graph save "Graph" "$out\r_asiap.gph", replace


twoway (bar i_af year, fcolor(gs8) lcolor(gs3)) (bar d_af year, fcolor(gs3)  lcolor(black)) (line c_af year, sort yaxis(2) lcolor(cranberry)), ytitle(Number of reforms) ytitle(Number of countries in sample, axis(2)) ymtick(0(10)40, axis(2)) xtitle(Year) title(Africa and Middle East) legend (off)/*(order(1 "CBI decreases" 2 "CBI increases" 3 "Number of countries (secondary axis)" ) rows (2) size(small))*/ graphregion(fcolor(white)) 

	   graph save "Graph" "$out\r_af.gph", replace

	   
twoway (bar i_eeu year, fcolor(gs8) lcolor(gs3)) (bar d_eeu year, fcolor(gs3)  lcolor(black)) (line c_eeu year, sort yaxis(2) lcolor(cranberry)), ytitle(Number of reforms) ytitle(Number of countries in sample, axis(2)) ymtick(0(10)40, axis(2)) xtitle(Year) title(Eastern Europe and former Soviet) legend (off)/*(order(1 "CBI decreases" 2 "CBI increases" 3 "Number of countries (secondary axis)" ) rows (2) size(small))*/ graphregion(fcolor(white)) 

	   graph save "Graph" "$out\r_eeu.gph", replace

   
twoway (bar i_wenam year, fcolor(gs8) lcolor(gs3)) (bar d_wenam year, fcolor(gs3)  lcolor(black)) (line c_wenam year, sort yaxis(2) lcolor(cranberry)), ytitle(Number of reforms) ytitle(Number of countries in sample, axis(2)) ymtick(0(10)30, axis(2)) xtitle(Year) title(Western Europe and North America) legend (off)/*(order(1 "CBI decreases" 2 "CBI increases" 3 "Number of countries (secondary axis)" ) rows (2) size(small))*/ graphregion(fcolor(white)) 

	   graph save "Graph" "$out\r_wenam.gph", replace
	   
  	   graph combine "$out\r_lam.gph" "$out\r_asiap.gph" "$out\r_af.gph" "$out\r_eeu.gph"  "$out\r_wenam.gph", ycommon xcommon rows(2) iscale(*1) xsize(35) ysize(20) graphregion(fcolor(white)) title (Regional subsamples) 

		graph save "Graph" "$out\r_subs_all.gph", replace

		graph combine "$out\r_all.gph" "$out\r_subs_all.gph", rows(1) iscale(*1) xsize(40) ysize(15) graphregion(fcolor(white)) title (Reforms increasing and decreasing CBI) 

	

*  Table 2: Inflation log, CBI as IV
   use Replication_ISQ_2025, clear

   tsset cowcode year

  *with  l.dv
   
    xtreg inf_ln ldv  l.inf_ln // column 1
     		outreg2 using "$out\T2.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)

	xtreg inf_ln l.lvaw_garriga2016 l.inf_ln  if ldv!=. // column 2
     		outreg2 using "$out\T2.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
	
      xtreg inf_ln ldv  l.inf_ln if e(sample) 
     		outreg2 using "$out\T2.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
	  
   xtreg inf_ln l.lvaw_bh l.inf_ln  if ldv!=.
     		outreg2 using "$out\T2.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
   
      xtreg inf_ln ldv l.inf_ln if e(sample) 
     		outreg2 using "$out\T2.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
	  
   xtreg inf_ln l.lvaw_ro l.inf_ln  if ldv!=.
     		outreg2 using "$out/T2.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
   
      xtreg inf_ln ldv l.inf_ln  if e(sample) 
     		outreg2 using "$out/T2.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
   

    * Appendix 7: no l.dv
   
    xtreg inf_ln ldv  // column 1
     		outreg2 using "$out/T2.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)

	xtreg inf_ln l.lvaw_garriga2016 if ldv!=. // column 2
     		outreg2 using "$out/T2.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
	
      xtreg inf_ln ldv if e(sample)
     		outreg2 using "$out/T2.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
	  
   xtreg inf_ln l.lvaw_bh if ldv!=. 
     		outreg2 using "$out/T2.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
   
      xtreg inf_ln ldv if e(sample) 
     		outreg2 using "$out/T2.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
	  
   xtreg inf_ln l.lvaw_ro if ldv!=. 
     		outreg2 using "$out/T2.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
     estimates store r
	 sum year if e(sample)
   
      xtreg inf_ln ldv  if e(sample) 
     		outreg2 using "$out/T2.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
  
   
    * Appendix 7: no l.dv, FE
   
    xtreg inf_ln ldv, fe  // column 1
     		outreg2 using "$out/T2.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)

	xtreg inf_ln l.lvaw_garriga2016 if ldv!=., fe // column 2
     		outreg2 using "$out/T2.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
	
      xtreg inf_ln ldv if e(sample), fe
     		outreg2 using "$out/T2.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
	  
   xtreg inf_ln l.lvaw_bh if ldv!=. , fe
     		outreg2 using "$out/T2.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
   
      xtreg inf_ln ldv if e(sample) , fe
     		outreg2 using "$out/T2.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
	  
   xtreg inf_ln l.lvaw_ro if ldv!=., fe 
     		outreg2 using "$out/T2.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
     estimates store r
	 sum year if e(sample)
   
      xtreg inf_ln ldv  if e(sample) , fe
     		outreg2 using "$out/T2.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
  

*  Table 3: Unemployment, CBI as IV
   use Replication_ISQ_2025, clear

   tsset cowcode year   
* w/ ldv
	 
   xtreg unemp_imp ldv l.unemp_imp // column 1
     		outreg2 using "$out/T3.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)

	xtreg unemp_imp l.lvaw_garriga2016 l.unemp_imp  // column 2
     		outreg2 using "$out/T3.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
	
      xtreg unemp_imp ldv l.unemp_imp if e(sample) 
     		outreg2 using "$out/T3.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
	  
   xtreg unemp_imp l.lvaw_bh l.unemp_imp 
     		outreg2 using "$out/T3.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
   
      xtreg unemp_imp ldv l.unemp_imp if e(sample) 
     		outreg2 using "$out/T3.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
	  
   xtreg unemp_imp l.lvaw_ro l.unemp_imp 
     		outreg2 using "$out/T3.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
   
      xtreg unemp_imp ldv l.unemp_imp if e(sample) 
     		outreg2 using "$out/T3.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
	 
	 
    * Appendix 7:  no ldv
   xtreg unemp_imp ldv  // column 1
     		outreg2 using "$out/T3.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)

	xtreg unemp_imp l.lvaw_garriga2016  if ldv!=.  // column 2
     		outreg2 using "$out/T3.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
	
      xtreg unemp_imp ldv if e(sample) 
     		outreg2 using "$out/T3.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
	  
   xtreg unemp_imp l.lvaw_bh  if ldv!=. 
     		outreg2 using "$out/T3.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
   
      xtreg unemp_imp ldv if e(sample)
     		outreg2 using "$out/T3.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
	  
   xtreg unemp_imp l.lvaw_ro  if ldv!=.
     		outreg2 using "$out/T3.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
   
      xtreg unemp_imp ldv if e(sample) 
     		outreg2 using "$out/T3.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
   
    * Appendix 7:  no ldv, FE
   xtreg unemp_imp ldv, fe  // column 1
     		outreg2 using "$out/T3.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)

	xtreg unemp_imp l.lvaw_garriga2016  if ldv!=., fe  // column 2
     		outreg2 using "$out/T3.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
	
      xtreg unemp_imp ldv if e(sample), fe 
     		outreg2 using "$out/T3.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
	  
   xtreg unemp_imp l.lvaw_bh  if ldv!=., fe 
     		outreg2 using "$out/T3.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
   
      xtreg unemp_imp ldv if e(sample), fe
     		outreg2 using "$out/T3.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
	  
   xtreg unemp_imp l.lvaw_ro  if ldv!=., fe
     		outreg2 using "$out/T3.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
   
      xtreg unemp_imp ldv if e(sample), fe 
     		outreg2 using "$out/T3.xls", excel alpha (0.01, 0.05, 0.1) symbol(***,**,*) dec(3) label addstat( R2 overall, e(r2_o), R2 within, e(r2_w), R2 between, e(r2_b)) 
	 sum year if e(sample)
      

 
 

* Figure 4: average CBI in the world per year (total and components)

use Replication_ISQ_2025, clear

tsset cowcode year

generate ceo_eeu=cuk_ceo if ht_region==1
generate ceo_lam=cuk_ceo if ht_region==2|ht_region==10
generate ceo_af=cuk_ceo if ht_region==3|ht_region==4
generate ceo_wenam=cuk_ceo if ht_region==5
generate ceo_asiap=cuk_ceo if ht_region==6|ht_region==7|ht_region==8|ht_region==9

generate obj_eeu=cuk_obj if ht_region==1
generate obj_lam=cuk_obj if ht_region==2|ht_region==10
generate obj_af=cuk_obj if ht_region==3|ht_region==4
generate obj_wenam=cuk_obj if ht_region==5
generate obj_asiap=cuk_obj if ht_region==6|ht_region==7|ht_region==8|ht_region==9

generate pol_eeu=cuk_pol if ht_region==1
generate pol_lam=cuk_pol if ht_region==2|ht_region==10
generate pol_af=cuk_pol if ht_region==3|ht_region==4
generate pol_wenam=cuk_pol if ht_region==5
generate pol_asiap=cuk_pol if ht_region==6|ht_region==7|ht_region==8|ht_region==9

generate limlen_eeu=cuk_limlen if ht_region==1
generate limlen_lam=cuk_limlen if ht_region==2|ht_region==10
generate limlen_af=cuk_limlen if ht_region==3|ht_region==4
generate limlen_wenam=cuk_limlen if ht_region==5
generate limlen_asiap=cuk_limlen if ht_region==6|ht_region==7|ht_region==8|ht_region==9

 
collapse (count) cowcode (mean) lvaw_garriga lvau_garriga cuk_ceo cuk_obj cuk_pol cuk_limlen ceo_eeu ceo_lam ceo_af ceo_wenam ceo_asiap obj_eeu obj_lam obj_af obj_wenam obj_asiap pol_eeu pol_lam pol_af pol_wenam pol_asiap limlen_eeu limlen_lam limlen_af limlen_wenam limlen_asiap, by (year)


label variable lvaw_garriga "Weighted index"
label variable lvau_garriga "Unweighted index"
label variable cuk_ceo "Personnel independence"
label variable cuk_pol "Policy formulation independence"
label variable cuk_obj "Objectives"
label variable cuk_limlen "Limits on lending"


twoway (line cuk_ceo year, sort lcolor(navy)lpattern(longdash)lwidth(medthick)) (line cuk_obj year, sort lcolor(orange_red)lpattern(dash_dot)lwidth(medthick))(line cuk_pol year, sort lcolor(cranberry)lpattern(dash_dot_dot)lwidth(medthick))(line cuk_limlen year, sort lcolor(teal)lpattern(vshortdash)lwidth(medthick)), ytitle(Average CBI component) xtitle(Year) legend(rows(2)) legend(size(small)) graphregion(fcolor(white)) title(Global sample) scheme(s1manual)
		 graph save "Graph" "$out\c_all.gph", replace

   		 
twoway (line ceo_lam year, sort lcolor(navy)lpattern(longdash)lwidth(medthick)) (line obj_lam year, sort lcolor(orange_red)lpattern(dash_dot)lwidth(medthick))(line pol_lam year, sort lcolor(cranberry)lpattern(dash_dot_dot)lwidth(medthick))(line limlen_lam year, sort lcolor(teal)lpattern(vshortdash)lwidth(medthick)), ytitle(Average CBI component) xtitle(Year) legend (off) graphregion(fcolor(white)) title(Latin America and the Caribbean) scheme(s1manual)
		 graph save "Graph" "$out\c_lam.gph", replace

	 
twoway (line ceo_asiap year, sort lcolor(navy)lpattern(longdash)lwidth(medthick)) (line obj_asiap year, sort lcolor(orange_red)lpattern(dash_dot)lwidth(medthick))(line pol_asiap year, sort lcolor(cranberry)lpattern(dash_dot_dot)lwidth(medthick))(line limlen_asiap year, sort lcolor(teal)lpattern(vshortdash)lwidth(medthick)), ytitle(Average CBI component) xtitle(Year) legend (off) graphregion(fcolor(white)) title(Asia and the Pacific) scheme(s1manual)
		 graph save "Graph" "$out\c_asia.gph", replace


twoway (line ceo_af year, sort lcolor(navy)lpattern(longdash)lwidth(medthick)) (line obj_af year, sort lcolor(orange_red)lpattern(dash_dot)lwidth(medthick))(line pol_af year, sort lcolor(cranberry)lpattern(dash_dot_dot)lwidth(medthick))(line limlen_af year, sort lcolor(teal)lpattern(vshortdash)lwidth(medthick)), ytitle(Average CBI component) xtitle(Year) legend (off) graphregion(fcolor(white)) title(Africa and Middle East) scheme(s1manual)
		 graph save "Graph" "$out\c_af.gph", replace

		 
twoway (line ceo_eeu year, sort lcolor(navy)lpattern(longdash)lwidth(medthick)) (line obj_eeu year, sort lcolor(orange_red)lpattern(dash_dot)lwidth(medthick))(line pol_eeu year, sort lcolor(cranberry)lpattern(dash_dot_dot)lwidth(medthick))(line limlen_eeu year, sort lcolor(teal)lpattern(vshortdash)lwidth(medthick)), ytitle(Average CBI component) xtitle(Year) legend (off) graphregion(fcolor(white)) title(Eastern Europe and former Soviet) scheme(s1manual)
		 graph save "Graph" "$out\c_eeu.gph", replace

		  
twoway (line ceo_wenam year, sort lcolor(navy)lpattern(longdash)lwidth(medthick)) (line obj_wenam year, sort lcolor(orange_red)lpattern(dash_dot)lwidth(medthick))(line pol_wenam year, sort lcolor(cranberry)lpattern(dash_dot_dot)lwidth(medthick))(line limlen_wenam year, sort lcolor(teal)lpattern(vshortdash)lwidth(medthick)), ytitle(Average CBI component) xtitle(Year) legend (off) graphregion(fcolor(white)) title(Western Europe and North America) scheme(s1manual)
		 graph save "Graph" "$out\c_wenam.gph", replace

  
  
		  graph combine "$out\c_lam.gph" "$out\c_asia.gph"  "$out\c_af.gph"  "$out\c_eeu.gph"  "$out\c_wenam.gph", ycommon xcommon rows(2) iscale(*.8) xsize(30) ysize(20) title (Regional samples) graphregion(fcolor(white)) 
		  graph save "Graph" "$out\c_reg.gph", replace


		  graph combine "$out\c_all.gph" "C:\Users\ag18428\Dropbox\Working papers\CBI\New research note\out\c_reg.gph", rows(1) iscale(*1.1) xsize(40) ysize(20) graphregion(fcolor(white)) title (The four dimensions of CBI) 
		  
		  graph save "Graph" "C:\Users\a[directory]e\out\Figure4.gph", replace

  

**********************************************************	
		

*  Appendix 1
   use Replication_ISQ_2025, clear

   tab cname if lvaw_garriga!=. & year >1969
   tab cname if lvaw_garriga2016!=. 
   tab cname if lvaw_bh!=. 
   tab cname if lvaw_ro!=. 
   

   tab cowcode if creation!=.
   tab cname if creation!=.
      tab cowcode if lvaw_garriga!=.
      tab cowcode if lvaw_garriga2016!=.
      tab cowcode if lvaw_bh!=.
      tab cowcode if lvaw_ro!=.

	  
*  Appendix 2
   sum cowcode year creation reform direction increase decrease regional cuk_ceo cuk_obj cuk_pol cuk_limlen lvau_garriga lvaw_garriga lvaw_garriga2016 lvaw_bh lvaw_ro diffusion_reg if creation!=. & regional==0 & year>1969

   
*        Appendix 3
*        graph other data coverage by region
** top panel: N of countries by region

   use Replication_ISQ_2025, clear

   tsset cowcode year

   generate lvaw_eeu=lvaw_garriga if ht_region==1
   generate lvaw_lam=lvaw_garriga if ht_region==2|ht_region==10
   generate lvaw_af=lvaw_garriga if ht_region==3|ht_region==4
   generate lvaw_wenam=lvaw_garriga if ht_region==5
   generate lvaw_asiap=lvaw_garriga if ht_region==6|ht_region==7|ht_region==8|ht_region==9

   generate lvaw_eeu_16=lvaw_garriga2016 if ht_region==1
   generate lvaw_lam_16=lvaw_garriga2016 if ht_region==2|ht_region==10
   generate lvaw_af_16=lvaw_garriga2016 if ht_region==3|ht_region==4
   generate lvaw_wenam_16=lvaw_garriga2016 if ht_region==5
   generate lvaw_asiap_16=lvaw_garriga2016 if ht_region==6|ht_region==7|ht_region==8|ht_region==9

   generate lvaw_eeu_bh=lvaw_bh if ht_region==1
   generate lvaw_lam_bh=lvaw_bh if ht_region==2|ht_region==10
   generate lvaw_af_bh=lvaw_bh if ht_region==3|ht_region==4
   generate lvaw_wenam_bh=lvaw_bh if ht_region==5
   generate lvaw_asiap_bh=lvaw_bh if ht_region==6|ht_region==7|ht_region==8|ht_region==9

   generate lvaw_eeu_ro=lvaw_ro if ht_region==1
   generate lvaw_lam_ro=lvaw_ro if ht_region==2|ht_region==10
   generate lvaw_af_ro=lvaw_ro if ht_region==3|ht_region==4
   generate lvaw_wenam_ro=lvaw_ro if ht_region==5
   generate lvaw_asiap_ro=lvaw_ro if ht_region==6|ht_region==7|ht_region==8|ht_region==9


   collapse (count) lvaw_eeu lvaw_lam lvaw_af lvaw_wenam lvaw_asiap lvaw_eeu_16 lvaw_lam_16 lvaw_af_16 lvaw_wenam_16 lvaw_asiap_16 lvaw_eeu_bh lvaw_lam_bh lvaw_af_bh lvaw_wenam_bh lvaw_asiap_bh lvaw_eeu_ro lvaw_lam_ro lvaw_af_ro lvaw_wenam_ro lvaw_asiap_ro, by (year)
  

foreach var of varlist lvaw_eeu- lvaw_asiap_ro{
recode `var' (0=.)
}


		
   twoway (line lvaw_lam year, sort lcolor(cranberry)) (line lvaw_lam_16 year, sort lcolor(gs4)lpattern(longdash)) (line lvaw_lam_ro year, lcolor(gs8) lpattern(dash_dot) lwidth(medthick) sort)  (line lvaw_lam_bh year, lcolor(emerald) lpattern(dash_3dot) lwidth(medthick) sort), ytitle(Number of countries) legend (off) graphregion(fcolor(white)) xtitle(Year) title(Latin America and the Caribbean)
		  graph save "Graph" "$out\n_lam.gph", replace
		  
		  
   twoway (line lvaw_asiap year, sort lcolor(cranberry)) (line lvaw_asiap_16 year, sort lcolor(gs4)lpattern(longdash))(line lvaw_asiap_ro year, lcolor(gs8) lpattern(dash_dot) lwidth(medthick) sort)  (line lvaw_asiap_bh year, lcolor(emerald) lpattern(dash_3dot) lwidth(medthick) sort) , ytitle(Number of countries) legend (off)  graphregion(fcolor(white)) xtitle(Year) title(Asia and the Pacific)
		  graph save "Graph" "$out\n_asia.gph", replace

   twoway (line lvaw_af year, sort lcolor(cranberry)) (line lvaw_af_16 year, sort lcolor(gs4)lpattern(longdash))(line lvaw_af_ro year, lcolor(gs8) lpattern(dash_dot) lwidth(medthick) sort)  (line lvaw_af_bh year, lcolor(emerald) lpattern(dash_3dot) lwidth(medthick) sort) , ytitle(Number of countries) legend (off) graphregion(fcolor(white)) xtitle(Year) title(Africa and Middle East)
		  graph save "Graph" "$out\n_af.gph", replace

   twoway (line lvaw_eeu year, sort lcolor(cranberry)) (line lvaw_eeu_16 year, sort lcolor(gs4)lpattern(longdash))(line lvaw_eeu_ro year, lcolor(gs8) lpattern(dash_dot) lwidth(medthick) sort)  (line lvaw_eeu_bh year, lcolor(emerald) lpattern(dash_3dot) lwidth(medthick) sort), ytitle(Number of countries) legend (off) graphregion(fcolor(white)) xtitle(Year) title(Eastern Europe and former Soviet)
		  graph save "Graph" "$out\n_eeu.gph", replace

   twoway (line lvaw_wenam year, sort lcolor(cranberry)) (line lvaw_wenam_16 year, sort lcolor(gs4)lpattern(longdash))(line lvaw_wenam_ro year, lcolor(gs8) lpattern(dash_dot) lwidth(medthick) sort)  (line lvaw_wenam_bh year, lcolor(emerald) lpattern(dash_3dot) lwidth(medthick) sort), ytitle(Number of countries) legend (off) graphregion(fcolor(white)) xtitle(Year) title(Western Europe and North America)
		  graph save "Graph" "$out\n_wenam.gph", replace


		  graph combine "$out\n_lam.gph" "$out\n_asia.gph" "$out\n_af.gph" "$out\n_eeu.gph"  "$out\n_wenam.gph", ycommon xcommon rows(1) iscale(*1.35) xsize(40) ysize(10)  graphregion(fcolor(white)) title (Countries included per year - Different datasets) subtitle(Regional samples)
		  graph save "Graph" "$out\n_all.gph", replace

		  
** bottom panel: CBI average, by region
   use Replication_ISQ_2025, clear

   tsset cowcode year
 
   drop if year<1970

   generate lvaw_eeu=lvaw_garriga if ht_region==1
   generate lvaw_lam=lvaw_garriga if ht_region==2|ht_region==10
   generate lvaw_af=lvaw_garriga if ht_region==3|ht_region==4
   generate lvaw_wenam=lvaw_garriga if ht_region==5
   generate lvaw_asiap=lvaw_garriga if ht_region==6|ht_region==7|ht_region==8|ht_region==9

   generate lvaw_eeu_16=lvaw_garriga2016 if ht_region==1
   generate lvaw_lam_16=lvaw_garriga2016 if ht_region==2|ht_region==10
   generate lvaw_af_16=lvaw_garriga2016 if ht_region==3|ht_region==4
   generate lvaw_wenam_16=lvaw_garriga2016 if ht_region==5
   generate lvaw_asiap_16=lvaw_garriga2016 if ht_region==6|ht_region==7|ht_region==8|ht_region==9

   generate lvaw_eeu_bh=lvaw_bh if ht_region==1
   generate lvaw_lam_bh=lvaw_bh if ht_region==2|ht_region==10
   generate lvaw_af_bh=lvaw_bh if ht_region==3|ht_region==4
   generate lvaw_wenam_bh=lvaw_bh if ht_region==5
   generate lvaw_asiap_bh=lvaw_bh if ht_region==6|ht_region==7|ht_region==8|ht_region==9
   
   
   generate lvaw_eeu_ro=lvaw_ro if ht_region==1
   generate lvaw_lam_ro=lvaw_ro if ht_region==2|ht_region==10
   generate lvaw_af_ro=lvaw_ro if ht_region==3|ht_region==4
   generate lvaw_wenam_ro=lvaw_ro if ht_region==5
   generate lvaw_asiap_ro=lvaw_ro if ht_region==6|ht_region==7|ht_region==8|ht_region==9


   collapse (mean) lvaw_eeu lvaw_lam lvaw_af lvaw_wenam lvaw_asiap lvaw_eeu_16 lvaw_lam_16 lvaw_af_16 lvaw_wenam_16 lvaw_asiap_16 lvaw_eeu_bh lvaw_lam_bh lvaw_af_bh lvaw_wenam_bh lvaw_asiap_bh lvaw_eeu_ro lvaw_lam_ro lvaw_af_ro lvaw_wenam_ro lvaw_asiap_ro , by (year)


foreach var of varlist lvaw_eeu- lvaw_asiap_ro{
recode `var' (0=.)
}	

		
   twoway (line lvaw_lam year, sort lcolor(cranberry)) (line lvaw_lam_16 year, sort lcolor(gs4)lpattern(longdash)) (line lvaw_lam_ro year, lcolor(gs8) lpattern(dash_dot) lwidth(medthick) sort)  (line lvaw_lam_bh year, lcolor(emerald) lpattern(dash_3dot) lwidth(medthick) sort), ytitle(CBI regional average) legend (off) graphregion(fcolor(white)) xtitle(Year) title(Latin America and the Caribbean)
		  graph save "Graph" "$out\a_lam.gph", replace
		  
   twoway (line lvaw_asiap year, sort lcolor(cranberry)) (line lvaw_asiap_16 year, sort lcolor(gs4)lpattern(longdash))(line lvaw_asiap_ro year, lcolor(gs8) lpattern(dash_dot) lwidth(medthick) sort)  (line lvaw_asiap_bh year, lcolor(emerald) lpattern(dash_3dot) lwidth(medthick) sort) , ytitle(CBI regional average) legend (off) graphregion(fcolor(white)) xtitle(Year) title(Asia and the Pacific)
		  graph save "Graph" "$out\a_asia.gph", replace

   twoway (line lvaw_af year, sort lcolor(cranberry)) (line lvaw_af_16 year, sort lcolor(gs4)lpattern(longdash))(line lvaw_af_ro year, lcolor(gs8) lpattern(dash_dot) lwidth(medthick) sort)  (line lvaw_af_bh year, lcolor(emerald) lpattern(dash_3dot) lwidth(medthick) sort) , ytitle(CBI regional average) legend (order(1 "Author" 2 "Garriga (2016)" 3 "Romelli (2023)" 4 "Bodea&Hicks (updated)" ) rows(2) size(small)) graphregion(fcolor(white)) xtitle(Year) title(Africa and Middle East)
		  graph save "Graph" "$out\a_af.gph", replace

   twoway (line lvaw_eeu year, sort lcolor(cranberry)) (line lvaw_eeu_16 year, sort lcolor(gs4)lpattern(longdash))(line lvaw_eeu_ro year, lcolor(gs8) lpattern(dash_dot) lwidth(medthick) sort)  (line lvaw_eeu_bh year, lcolor(emerald) lpattern(dash_3dot) lwidth(medthick) sort), ytitle(CBI regional average) legend (off) graphregion(fcolor(white)) xtitle(Year) title(Eastern Europe and former Soviet)
		  graph save "Graph" "$out\a_eeu.gph", replace

   twoway (line lvaw_wenam year, sort lcolor(cranberry)) (line lvaw_wenam_16 year, sort lcolor(gs4)lpattern(longdash))(line lvaw_wenam_ro year, lcolor(gs8) lpattern(dash_dot) lwidth(medthick) sort)  (line lvaw_wenam_bh year, lcolor(emerald) lpattern(dash_3dot) lwidth(medthick) sort), ytitle(CBI regional average) legend (off) /*legend(order(1 "Author" 2 "Garriga (2016)" 3 "Romelli (2022)" 4 "Bodea & Hicks (2015)" ) rows(2) size(small))*/ graphregion(fcolor(white)) xtitle(Year) title(Western Europe and North America)
		  graph save "Graph" "$out\a_wenam.gph", replace
		  

		  graph combine "$out\a_lam.gph" "$out\a_asia.gph" "$out\a_af.gph"  "$out\a_eeu.gph" "$out\a_wenam.gph", ycommon xcommon rows(1) iscale(*1.35) xsize(40) ysize(10)  graphregion(fcolor(white)) title (Average CBI - Different datasets) subtitle(Regional samples)
		  graph save "Graph" "$out\a_all.gph", replace

	  
   
*  Appendix 4

   use Replication_ISQ_2025, clear
 
*            Data for "included"
   sum p_polity2 inf_imp GDPpc wdi_trade ka_open lvaw_garriga year if lvaw_garriga!=. & year >1969
   sum p_polity2 inf_imp GDPpc wdi_trade ka_open lvaw_garriga year if lvaw_garriga2016!=. & year <2013  & year >1969
   sum p_polity2 inf_imp GDPpc wdi_trade ka_open lvaw_garriga year if lvaw_bh!=. & year <2021  & year >1969
   sum p_polity2 inf_imp GDPpc wdi_trade ka_open lvaw_garriga year if lvaw_ro!=. & year <2018 & year >1971

   *            Data for "excluded"
   sum p_polity2 inf_imp GDPpc wdi_trade ka_open lvaw_garriga year if lvaw_garriga2016==. & lvaw_garriga!=. & year <2013  & year >1969
   sum p_polity2 inf_imp GDPpc wdi_trade ka_open lvaw_garriga year if lvaw_bh==. & lvaw_garriga!=. & year <2021  & year >1969 
   sum p_polity2 inf_imp GDPpc wdi_trade ka_open lvaw_garriga year if lvaw_ro==. & lvaw_garriga!=. & year <2018 & year >1971

   
*  Appendix 5
   use Replication_ISQ_2025, clear

   pwcorr lvaw_garriga lvaw_garriga2016 lvaw_cuk lvaw_bh lvaw_ro  
   

   
* Appendix 6  Count of reforms affecting CBI, and countries included in samples. Worldwide and regional subsamples EXCLUDING REGIONAL CENTRAL BANKS.

   use Replication_ISQ_2025, clear
   drop if creation==.

 * for figures w/o regional central banks
	 replace lvaw_garriga=. if regional==1
	 replace increase=. if regional==1
	 replace decrease=. if regional==1

generate lvaw_eeu=lvaw_garriga if ht_region==1
generate lvaw_lam=lvaw_garriga if ht_region==2|ht_region==10
generate lvaw_af=lvaw_garriga if ht_region==3|ht_region==4
generate lvaw_wenam=lvaw_garriga if ht_region==5
generate lvaw_asiap=lvaw_garriga if ht_region==6|ht_region==7|ht_region==8|ht_region==9

generate i_eeu=increase if ht_region==1
generate i_lam=increase if ht_region==2|ht_region==10
generate i_af=increase if ht_region==3|ht_region==4
generate i_wenam=increase if ht_region==5
generate i_asiap=increase if ht_region==6|ht_region==7|ht_region==8|ht_region==9

generate d_eeu=decrease if ht_region==1
generate d_lam=decrease if ht_region==2|ht_region==10
generate d_af=decrease if ht_region==3|ht_region==4
generate d_wenam=decrease if ht_region==5
generate d_asiap=decrease if ht_region==6|ht_region==7|ht_region==8|ht_region==9

generate c_eeu=1 if ht_region==1
generate c_lam=1 if ht_region==2|ht_region==10
generate c_af=1 if ht_region==3|ht_region==4
generate c_wenam=1 if ht_region==5
generate c_asiap=1 if ht_region==6|ht_region==7|ht_region==8|ht_region==9

 
collapse (sum) reform increase decrease i_eeu i_lam i_af i_wenam i_asiap d_eeu d_lam d_af d_wenam d_asiap c_eeu c_lam c_af c_wenam c_asiap (count) cowcode (mean) lvaw_eeu lvaw_lam lvaw_af lvaw_wenam lvaw_asiap , by (year)

* Reforms per country and per year

replace decrease=(-1)*decrease
rename decrease CBI_decreases
rename increase CBI_increases
gen Year=.
replace Year=year if year==1970|year==1980|year==1990|year==2000|year==2010
replace d_eeu=(-1)*d_eeu
replace d_lam=(-1)*d_lam
replace d_af=(-1)*d_af
replace d_wenam=(-1)*d_wenam
replace d_asiap=(-1)*d_asiap
    


twoway (bar CBI_increases year, fcolor(gs9) lcolor(gs3)) (bar CBI_decreases year, fcolor(gs4)  lcolor(black)) (line cowcode year, sort yaxis(2) lcolor(cranberry)), ytitle(Number of reforms) ytitle(Number of countries in sample, axis(2)) xtitle(Year) title(World sample) subtitle ((Regional central banks excluded)) legend (order(1 "CBI increases" 2 "CBI decreases" 3 "Number of countries (secondary axis)" ) rows (2) size(small)) graphregion(fcolor(white)) 

	   graph save "Graph" "$out\r_allnoreg.gph", replace

twoway (bar i_lam year, fcolor(gs9) lcolor(gs3)) (bar d_lam year, fcolor(gs3)  lcolor(black)) (line c_lam year, sort yaxis(2) lcolor(cranberry)), ytitle(Number of reforms) ytitle(Number of countries in sample, axis(2)) ymtick(0(10)40, axis(2)) xtitle(Year) title(Latin America and the Caribbean) legend (off)/*(order(1 "CBI decreases" 2 "CBI increases" 3 "Number of countries (secondary axis)" ) rows (2) size(small))*/ graphregion(fcolor(white)) 
	   graph save "Graph" "$out\r_lamnoreg.gph", replace

twoway (bar i_asiap year, fcolor(gs9) lcolor(gs3)) (bar d_asiap year, fcolor(gs3)  lcolor(black)) (line c_asiap year, sort yaxis(2) lcolor(cranberry)), ytitle(Number of reforms) ytitle(Number of countries in sample, axis(2)) ymtick(0(10)40, axis(2)) xtitle(Year) title(Asia and the Pacific) legend (off)/*(order(1 "CBI decreases" 2 "CBI increases" 3 "Number of countries (secondary axis)" ) rows (2) size(small))*/ graphregion(fcolor(white)) 
	   	graph save "Graph" "$out\r_asiapnoreg.gph", replace


twoway (bar i_af year, fcolor(gs9) lcolor(gs3)) (bar d_af year, fcolor(gs3)  lcolor(black)) (line c_af year, sort yaxis(2) lcolor(cranberry)), ytitle(Number of reforms) ytitle(Number of countries in sample, axis(2)) ymtick(0(10)40, axis(2)) xtitle(Year) title(Africa and Middle East) legend (off)/*(order(1 "CBI decreases" 2 "CBI increases" 3 "Number of countries (secondary axis)" ) rows (2) size(small))*/ graphregion(fcolor(white)) 
	   graph save "Graph" "$out\r_afnoreg.gph", replace

	   
twoway (bar i_eeu year, fcolor(gs9) lcolor(gs3)) (bar d_eeu year, fcolor(gs3)  lcolor(black)) (line c_eeu year, sort yaxis(2) lcolor(cranberry)), ytitle(Number of reforms) ytitle(Number of countries in sample, axis(2)) ymtick(0(10)40, axis(2)) xtitle(Year) title(Eastern Europe and former Soviet) legend (off)/*(order(1 "CBI decreases" 2 "CBI increases" 3 "Number of countries (secondary axis)" ) rows (2) size(small))*/ graphregion(fcolor(white)) 
	   graph save "Graph" "$out\r_eeunoreg.gph", replace

   
twoway (bar i_wenam year, fcolor(gs9) lcolor(gs3)) (bar d_wenam year, fcolor(gs3)  lcolor(black)) (line c_wenam year, sort yaxis(2) lcolor(cranberry)), ytitle(Number of reforms) ytitle(Number of countries in sample, axis(2)) ymtick(0(10)30, axis(2)) xtitle(Year) title(Western Europe and North America) legend (off)/*(order(1 "CBI decreases" 2 "CBI increases" 3 "Number of countries (secondary axis)" ) rows (2) size(small))*/ graphregion(fcolor(white)) 
	   graph save "Graph" "$out\r_wenamnoreg.gph", replace
	   

		  graph combine "$out\r_lamnoreg.gph" "$out\r_asiapnoreg.gph" "$out\r_afnoreg.gph" "$out\r_eeunoreg.gph"  "$out\r_wenamnoreg.gph", ycommon xcommon rows(2) iscale(*1.1) xsize(35) ysize(20) graphregion(fcolor(white)) title (Regional subsamples) subtitle ((Regional central banks excluded))

		  	   graph save "Graph" "$out\r_subs_allnoreg.gph", replace

		  graph combine "$out\r_allnoreg.gph" "$out\r_subs_allnoreg.gph", rows(1) iscale(*.95) xsize(40) ysize(15) graphregion(fcolor(white)) title (Reforms increasing and decreasing CBI) 
		  graph save "Graph"  "$out\Reforms_allnoreg.gph", replace

	
*******************************
		  
*    Maps
*   NOTE: users need to have both the map and the data files in the same folder/directory

cd "C:\Users\[directory]"  

   use Replication_ISQ_2025, clear

    drop if year<1970
    tsset cowcode year

    bysort cowcode: gen cbi_20=lvaw_garriga - lvaw_garriga[_n-23]
    bysort cowcode: gen cbi_sincegfc=lvaw_garriga - lvaw_garriga[_n-16]
    sum cbi_20 if year==2023, detail
	list cname lvaw_garriga cbi_20 if cbi_20<-0.15 & year==2023
	list cname lvaw_garriga cbi_20 if cbi_20>.44 & cbi_20!=. & year==2023 & regional==0

    sum cbi_sincegfc if year==2023, detail
    tab cbi_sincegfc if year==2023
	list cname lvaw_garriga cbi_20 if cbi_sincegfc<-0.15 & cbi_20!=. & year==2023 & regional==0

    gen cbi_change=cbi_sincegfc
replace cbi_change=-.6 if cbi_sincegfc>-.7 & cbi_sincegfc<-.5
replace cbi_change=-.3 if cbi_sincegfc>-.4 & cbi_sincegfc<-.3
replace cbi_change=-.2 if cbi_sincegfc>-.3 & cbi_sincegfc<-.2
replace cbi_change=-.1 if cbi_sincegfc>-.2 & cbi_sincegfc<-.1
replace cbi_change=-.01 if cbi_sincegfc>-.1 & cbi_sincegfc<0
replace cbi_change=.01 if cbi_sincegfc>0 & cbi_sincegfc<.1
replace cbi_change=.1 if cbi_sincegfc>.1 & cbi_sincegfc<.2
replace cbi_change=.2 if cbi_sincegfc>.2 & cbi_sincegfc<.3
replace cbi_change=.3 if cbi_sincegfc>.3 & cbi_sincegfc<.4
replace cbi_change=.4 if cbi_sincegfc>.4 & cbi_sincegfc<.5
replace cbi_change=.5 if cbi_sincegfc>.5

    gen cbi_20ch=cbi_20
replace cbi_20ch=-.6 if cbi_20>-.8 & cbi_20<-.5
replace cbi_20ch=-.4 if cbi_20>-.5 & cbi_20<-.4
replace cbi_20ch=-.3 if cbi_20>-.4 & cbi_20<-.3
replace cbi_20ch=-.2 if cbi_20>-.3 & cbi_20<-.2
replace cbi_20ch=-.1 if cbi_20>-.2 & cbi_20<-.1
replace cbi_20ch=-.01 if cbi_20>-.1 & cbi_20<0
replace cbi_20ch=.01 if cbi_20>0 & cbi_20<.1
replace cbi_20ch=.1 if cbi_20>.1 & cbi_20<.2
replace cbi_20ch=.2 if cbi_20>.2 & cbi_20<.3
replace cbi_20ch=.3 if cbi_20>.3 & cbi_20<.4
replace cbi_20ch=.4 if cbi_20>.4 & cbi_20<.5
replace cbi_20ch=.5 if cbi_20>.5 & cbi_20<.6
replace cbi_20ch=.6 if cbi_20>.6 & cbi_20<.7

    gen cbi_1=lvaw_garriga
replace cbi_1=round(cbi_1, 0.1)


local palettes

foreach scheme in bluered bluered2 bluered3 greenorange browngreen ///
    pinkgreen purplegreen {
     local palettes `palettes' HCL `scheme' /
  }


 * Figure 3 Central bank independence in the world (2023)
 
        spmap cbi_1 using world_shp if year==2023,  id(_ID) mfcolor(sand) osize(vthin ..)  ///
  clmethod(unique) fcolor(teal*.02 teal*.05 teal*.10 teal*.15 teal*.3 teal*.6 teal*.75 teal*1.1 teal*1.6 teal*2.3 teal*3) ndfcolor(yellow*.3) ndlabel(No Data) ///
  legenda (on) legtitle(Key) legcount legstyle(2)  /// 
   title("Central bank independence", size(medsmall)) subtitle("2023", size(small)) ///
   note("Mercator projection. Antarctica and Greenland dropped from maps." , size(vsmall))  
  	
	
	
*  Figure 5. Changes in central bank independence in the world between 2000 and 2023
  
spmap cbi_20ch using world_shp if year==2023, id(_ID) mfcolor(sand) osize(vthin ..)  ///
  clmethod(unique) fcolor(cranberry*1.3 cranberry*1.1 cranberry*.9 cranberry*.7 cranberry*.5 gs15*.5 forest_green*.4 forest_green*.6 forest_green*.8 forest_green*1 forest_green*1.2 forest_green*1.4 forest_green*1.6 ) ndfcolor(yellow*.3) ndlabel(No Data) /// 
  legend(pos(7) size(*1)) legstyle(2)  /// 
   title("Change in CBI scores", size(medsmall)) subtitle("2000-2023", size(small)) ///
   note("Mercator projection. Antarctica and Greenland dropped from map." , size(vsmall))  

    
*  Appendix 8. Changes in central bank independence in the world between 2008 and 2023
  
    
spmap cbi_change using world_shp if year==2023, id(_ID) mfcolor(sand) osize(vthin ..)  ///
  clmethod(unique) fcolor(cranberry*1.3 cranberry*1 cranberry*.8 cranberry*.6 cranberry*.4 gs15*.5 forest_green*.6 forest_green*.8 forest_green*1.0 forest_green*1.2 forest_green*1.4) ndfcolor(yellow*.3) ndlabel(No Data) ///
  legend(pos(7) size(*1)) legstyle(2) legtitle(Key) /// 
   title("Change in CBI scores", size(medsmall)) subtitle("2008-2023", size(small)) ///
   note("Mercator projection. Antarctica and Greenland dropped from map." , size(vsmall))  


